package com.huel.liweijian.Service.Operations;

import com.huel.liweijian.Service.CalculatorService;

/**
 * @author Liweijian.
 * @date 2024/9/4 10:40
 */
public class SqrtOperation implements CalculatorService {
    @Override
    public double calculate(double a, Double b) {
        if (a < 0) {
            throw new IllegalArgumentException("负数不能开根号"); // 检查负数
        }
        return Math.sqrt(a);
    }
}
